package com.zhudeshuai.zhudemolist.activity;

import android.os.Bundle;
import android.os.Handler;

import com.zhu.zhuCore.utils.LogUtil;
import com.zhu.zhuCore.utils.ToastUtil;
import com.zhudeshuai.zhudemolist.R;
import com.zhudeshuai.zhudemolist.base.BaseActivity;
import com.zhudeshuai.zhudemolist.fragment.TestFragment;

/**
 * 测试Activity与Fragment生命周期相关
 *
 * @author zhudeshuai
 * @since 2018/5/31
 */
public class TestFragmentActivity extends BaseActivity {

	private TestFragment mTestFragment = new TestFragment();

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		LogUtil.d("TAG","Activity--onCreate");
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_test_fragment);

		//添加fragment
		getSupportFragmentManager().beginTransaction().add(R.id.content_ll,mTestFragment).commit();


		new Handler().postDelayed(new Runnable() {
			@Override
			public void run() {
				ToastUtil.show(getString(R.string.test));
			}
		},2000);
	}

	@Override
	protected void onStart() {
		super.onStart();
		LogUtil.d("TAG","Activity--onStart");
	}

	@Override
	protected void onResume() {
		super.onResume();
		LogUtil.d("TAG","Activity--onResume");
	}

	@Override
	protected void onStop() {
		super.onStop();
		LogUtil.d("TAG","Activity--onStop");
	}

	@Override
	protected void onPause() {
		super.onPause();
		LogUtil.d("TAG","Activity--onPause");
	}

	@Override
	protected void onDestroy() {
		super.onDestroy();
		LogUtil.d("TAG","Activity--onDestroy");
	}

	@Override
	protected void onSaveInstanceState(Bundle outState) {
//		super.onSaveInstanceState(outState);
		LogUtil.d("TAG","Activity--onSaveInstanceState");
	}
}
